var clock = '';
var nums = 60;
var btn;

function sendCode(thisBtn) {
    btn = thisBtn;
    btn.disabled = true; //将按钮置为不可点击
    document.getElementById("yzm").className = "bts";
    document.getElementById("yzm").style.cursor = "default";
    btn.value = nums + '秒后可重新获取';
    clock = setInterval(doLoop, 1000); //一秒执行一次
}

function doLoop() {
    nums--;
    if (nums > 0) {
        btn.value = nums + '秒后可重新获取';
    } else {
        clearInterval(clock); //清除js定时器
        btn.disabled = false;
        document.getElementById("yzm").className = "bt";
        document.getElementById("yzm").style.cursor = "pointer";
        btn.value = '发送动态码';
        nums = 60; //重置时间
    }
}